{% extends "reg6/reg.html" %}
{% load i18n %}
{% load reg6_filters %}
{% block content %}
<div id="content-main">
<style type="text/css">
.reg6_form_error { color: #FF0000; font-weight: bold }
</style>

{% if ticket and total %}
    {% if promo %}
    <p>
    You are using promo code <b>{{ promo|escape }}</b>.
    </p>
    {% endif %}

    <p>
    Your {{ ticket.description|escape }} costs {{ ticket.price|money }}.
    </p>

    {% if items %}
    <p>
    You added the following additional items:
    </p>

    <p>
    {% for item in items %}
        * {{ item.description|escape }} ({{ item.price|money|escape }})<br />
    {% endfor %}
    </p>
    {% endif %}

    <p>
    Your total is {{ total|money|escape }}.
    </p>

    <p>
    We now need the following information from you. The fields in <b>bold</b>
    are required.
    </p>

    <form method="post" action=".">
    <input type="hidden" name="promo" value="{{ promo|escape }}" />
    <input type="hidden" name="ticket" value="{{ ticket.name|escape }}" />
    {% for item in items %}
        <input type="hidden" name="item{{ forloop.counter0 }}" value="{{ item.name|escape }}" />
    {% endfor %}

    {% if form.has_errors %}
    <h2>Please correct the following error{{ form.error_dict|pluralize }}:</h2>
    {% endif %}

    <table>
    <tr>
        <td><label for="id_salutation">Salutation:</label></td>
        <td>{{ form.salutation }}<br />
        {% if form.salutation.errors %}<span class="reg6_form_error">{{ form.salutation.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_first_name"><b>First Name:</b></label></td>
        <td>{{ form.first_name }}<br />
        {% if form.first_name.errors %}<span class="reg6_form_error">{{ form.first_name.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_last_name"><b>Last Name:</b></label></td>
        <td>{{ form.last_name }}<br />
        {% if form.last_name.errors %}<span class="reg6_form_error">{{ form.last_name.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_title">Title:</label></td>
        <td>{{ form.title }}<br />
        {% if form.title.errors %}<span class="reg6_form_error">{{ form.title.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_org">Organization:</label></td>
        <td>{{ form.org }}<br />
        {% if form.org.errors %}<span class="reg6_form_error">{{ form.org.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_phone">Phone:</label></td>
        <td>{{ form.phone }}<br />
        {% if form.phone.errors %}<span class="reg6_form_error">{{ form.phone.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_zip"><b>Zip:</b></label></td>
        <td>{{ form.zip }}<br />
        {% if form.zip.errors %}<span class="reg6_form_error">{{ form.zip.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td><label for="id_email"><b>Email:</b></label></td>
        <td>{{ form.email }}<br />
        {% if form.email.errors %}<span class="reg6_form_error">{{ form.email.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    <tr>
        <td colspan="2"><label for="id_can_email">Add me to the SCALE mailing list:</label> &nbsp;&nbsp;&nbsp;&nbsp;
        {{ form.can_email }}<br />
        {% if form.can_email.errors %}<span class="reg6_form_error">{{ form.can_email.errors|join:", " }}</span>{% endif %}
        </td>
    </tr>
    </table>

    {% if questions %}
    <p>
    Survey Questions:
    </p>

    {% if form.answers.errors %}
    <p>
    <span class="reg6_form_error">{{ form.answers.errors|join:", " }}</span>
    </p>
    {% endif %}

    <p>
    <table>
    {% for q in questions %}
    <tr>
        <td colspan="2">{{ q.text|escape }}</td>
    </tr>
    <tr>
    <td>
    <select name="q{{ forloop.counter0 }}" size="1">
        <option value="" selected="selected"></option>
        {% for ans in q.get_answers %}
        <option value="{{ ans.id }}">{{ ans.text }}</option>
        {% endfor %}
    </select>
    </td>
    </tr>
    {% endfor %}
    </table>
    </p>
    {% endif %}
    <p>
    <input type="submit" value="Continue" />
    </p>
    </form>

    <form method="post" action="../">
    <p>
    <input type="hidden" name="promo" value="{{ promo|escape }}" />
    <input type="submit" value="Start Over" />
    </p>
    </form>
{% else %}
Registration is closed.
{% endif %}
</div>
{% endblock %}

